import 'package:flutter/material.dart';
import 'package:mock_douban/pages/home/home_page.dart';
import 'package:mock_douban/pages/mine/mine_page.dart';
import 'package:mock_douban/widgets/dashed_line.dart';
import 'package:mock_douban/widgets/star_rating.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Mock 豆瓣 App',
      theme: ThemeData(
        primarySwatch:  Colors.green,
      ),
      home: const AppEntrancePage(),
    );
  }
}

class AppEntrancePage extends StatefulWidget {
  const AppEntrancePage({super.key,});

  @override
  State<AppEntrancePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<AppEntrancePage> {
  int _currentIndex = 0; // 当前选中的导航索引

  @override
  Widget build(BuildContext context) {
    return Scaffold(

      body: IndexedStack(
        index: _currentIndex,
        children: [
          DBHomePage(),
          DBMinePage(), // 假设第二个页面是另一个实例或不同的 Widget
        ],
      ),
      bottomNavigationBar: BottomNavigationBar(
        selectedFontSize: 20,
        unselectedFontSize: 20,
        currentIndex: _currentIndex,
        onTap: (index) {
          setState(() {
            _currentIndex = index;
          });
        },
        type: BottomNavigationBarType.fixed,
        items: [
          BottomNavigationBarItem(label:"Home",icon: Icon(Icons.home_outlined,size: 30,),activeIcon:Icon(Icons.home,size: 30,) ),
          BottomNavigationBarItem(label:"Mine",icon: Icon(Icons.class_outlined,size: 30,),activeIcon:Icon(Icons.class_,size: 30,)),
        ],
      ),
    );
  }
}